<html>

<head>
  <meta charset="UTF-8">
  <title>安全员证书查询</title>

</head>

<body monica-version="3.2.2" monica-id="ofpnmcalabcbjgholdjcjblkibolbppb"><input type="hidden" name="ggfwUrl"
    id="ggfwUrl" class="order-flag" value="https://txjs.miit.gov.cn/">

  <link rel="stylesheet" href="./cssui/layout/font-awesome.min.css">
  <link class="current" rel="stylesheet" href="./cssui/main/input.css">
  <link class="current" rel="stylesheet" href="./cssui/main/main.css">
  <link class="cpluginsurrent" rel="stylesheet" href="./cssui/main/index.css">
  <link class="current" rel="stylesheet" href="./cssui/layout/font-awesome.min.css">
  <link rel="stylesheet" href="./cssui/plugins/jqdialog/jqdialog.css">
  <style type="text/css">
    body,
    div,
    dl,
    dt,
    dd,
    ul,
    ol,
    li,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    form,
    fieldset,
    input,
    textarea,
    p,
    th,
    td {
      padding: 0;
      margin: 0;
      font-size: 14px;
      font-family: "Microsoft YaHei";
    }

    .content {
      padding: 15px;
      margin-right: auto;
      margin-left: auto;
      padding-left: 15px;
      padding-right: 15px;
    }

    .search_title {
      float: left;
      font-size: 18px;
      line-height: 30px;
      color: #0066CC;
      text-indent: 32px;
      background-image: url(title_icon.png);
      background-position: left center;
      background-repeat: no-repeat;
    }

    .controls {
      margin: 0 0 26px 0;
      padding-top: 0;
      overflow: hidden;
    }

    .border-bottom {
      width: 100%;
      border-bottom: 1px solid #d6d7dc;
      display: inline-block;
    }

    .table-search {
      width: 100%;
      color: #666666;
    }

    .table-search input,
    .table-search select {
      float: left;
      border-radius: 3px;
      font-size: 12px;
      line-height: 30px;
      height: 30px;
      _height: 28px;
      *height: 25px;
    }

    .table-search ul {
      width: 100%;
      overflow: hidden;
    }

    .table-search ul li span {
      position: relative;
      display: table;
      float: left;
      margin-right: 4px;
    }

    .table-search ul li span b {
      display: table-cell;
      width: 100%;
      height: 30px;
      line-height: 14px;
      vertical-align: middle;
      font-weight: normal;
      text-align: right;
    }

    .input-small {
      width: 70%;
    }

    input,
    select,
    input[type="file"] {
      border: 1px solid #ccc;
    }

    select,
    textarea,
    input[type="text"],
    input[type="password"],
    input[type="datetime"],
    input[type="datetime-local"],
    input[type="date"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    input[type="search"],
    input[type="tel"],
    input[type="color"],
    .uneditable-input {
      padding: 0 6px;
    }

    ul li {
      float: left;
      list-style: none;
      margin-left: 0;
      margin-bottom: 16px;
      width: 50%;
    }

    li {
      display: list-item;
      text-align: -webkit-match-parent;
    }

    ol,
    ul,
    li {
      list-style: none;
    }

    body,
    div,
    p,
    ul,
    li {
      margin: 0;
      padding: 0;
    }

    ul,
    li {
      list-style: none;
    }

    ul,
    ol,
    li {
      padding: 0;
      list-style: none;
      text-decoration: none;
    }

    .title_two {
      background: #0066cc;
      height: 20px;
      width: 4px;
      border-radius: 2px;
      margin-right: 10px;
      color: #0066cc;
    }

    .box-body-left {
      float: left;
      height: 34px;
      line-height: 34px;
      width: 100%;
    }

    .border_lineL {
      border: none;
      border-bottom: 1px solid #ccc;
      width: 20%;
    }

    .text-center {
      text-align: center;
    }

    .w_100 {
      width: 100%;
    }

    .btn-search {
      width: 90px;
      height: 32px;
    }

    .btn-primary {
      color: #fff;
      background-color: #0066cc;
      border-color: #0563c1;
    }

    .btn {
      display: inline-block;
      padding: 6px 12px;
      margin-bottom: 0;
      font-size: 14px;
      font-weight: normal;
      line-height: 1.42857143;
      text-align: center;
      white-space: nowrap;
      vertical-align: middle;
      -ms-touch-action: manipulation;
      touch-action: manipulation;
      cursor: pointer;
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      background-image: none;
      border-radius: 3px;
      -webkit-box-shadow: none;
      box-shadow: none;
      border-width: 1px;
      border-style: solid;
    }

    .table-bordered {
      border: 1px solid #ccc;
    }

    th.text-right {
      height: 34px;
      font-size: 14px;
      font-weight: 500;
      color: #666;
      background: #f5f5f5;
    }

    .spanl {
      color: #666;
    }

    table {
      border-spacing: 0;
      background-color: transparent;
      border-collapse: collapse;
    }

    .table-bordered th,
    .table-bordered td {
      border-right: 1px solid #d2d6de;
      border-bottom: 1px solid #d2d6de;
      border-top: none;
      word-break: break-all;
      word-wrap: break-word;
    }

    .btn-primary:hover,
    .btn-primary:active,
    .btn-primary.hover {
      background-color: #0e76d8;
    }
  </style>


  <div class="wrapper">
    <div class="head">
      <div class="head_box">
        <a href="#" class="hlw_logo"></a>
        <div class="hlw_pover">
          <div class="hlw_dl">
            <!-- 		<a class="long_up" href="../console.jsp" onclick="">登录</a>
              <a class="long_up" href="#" onclick="">注册</a> -->
          </div>
        </div>
      </div>
    </div>
    <div class="content" style="width: 1000px">


      <div class="box-body-left ">
        <b class="title_two" style="float: left; margin-top: 6px;"></b><span>查询结果</span>
      </div>

      <table class="table table-bordered  table-hover" style="width:100%; margin: auto">
        <tbody>
          <tr>
            <th class="text-right" width="100px">姓名</th>
            <td width="384.5px" class="text-left">
              <li id="NAME"></li>
            </td>
            <th class="text-right" width="100px">性别</th>
            <td class="text-left">
              <li id="SEX"></li>
            </td>
          </tr>
          <tr>
            <th class="text-right">身份证号</th>
            <td class="text-left">
              <li id="CARD_NUM"></li>
            </td>
            <th class="text-right">企业名称</th>
            <td class="text-left">
              <li id="COMPANY_NAME"></li>
            </td>
          </tr>
          <tr>
            <th class="text-right" width="100px">考核机关</th>
            <td class="text-left">
              <li id="CERTIFICATE_DEPARTMENT">云南省通信管理局</li>
            </td>
            <th class="text-right" width="100px">证书编号</th>
            <td class="text-left">
              <li id="CERTIFICATE_NUMBER"></li>
            </td>

          </tr>
          <tr>
            <th class="text-right">职务</th>
            <td class="text-left">
              <li id="POSITION"></li>
            </td>
            <th class="text-right">技术职称</th>
            <td class="text-left">
              <li id="PROFESSIONAL_TITLE"></li>
            </td>
          </tr>
          <tr>
            <th class="text-right">初次发证日期</th>
            <td class="text-left">
              <li id="PUBLISH_DATE"></li>
            </td>
            <th class="text-right">证书到期日期</th>
            <td class="text-left">
              <li id="END_DATE"></li>
            </td>
          </tr>
        </tbody>
      </table>

      <div class="box-body-left ">
        <b class="title_two" style="float: left; margin-top: 6px;"></b><span>变更记录</span>
      </div>
      <div class="box-table  overflow-x" style="overflow : scroll ;height: 180px;">
        <div class="table-responsive">
          <table class="table table-bordered  table-hover">
            <thead>
              <tr>
                <th>变更时间</th>
                <th>变更内容</th>
                <th>变更前信息</th>
                <th>变更后信息</th>
              </tr>

            </thead>
            <tbody id="ad"></tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="hlw_foot">
      <div class="hlw_fcenter">
        主办单位：中华人民共和国工业和信息化部 地址：中国北京西长安街13号 邮编：100804<br>
        工业和信息化部 版权所有 京ICP备 0400001号 网站标识码 bm07000001
      </div>
    </div>
    <script src="./dist/jequery.js"></script>
    <script>
      function hideName(name) {
        if (typeof name !== 'string' || name.length === 0) {
          return '' // 如果姓名不是字符串或者为空，返回空字符串
        }

        const nameArray = name.split(' ') // 将姓名按空格分割成数组（假设名和姓由空格分隔）

        // 隐藏除了姓的其他部分
        const hiddenChars = nameArray[0].length < 3 ? 1 : 2 // 保留名字的前1或2个字符
        const hiddenPart = '*'.repeat(hiddenChars)

        // 生成隐藏后的姓名
        let hiddenName = hiddenPart
        if (nameArray.length > 1) {
          hiddenName += ' ' + '*'.repeat(nameArray[nameArray.length - 1].length)
        }

        return hiddenName
      }
      function maskIDNumber(idNumber) {
        // 检查输入的身份证号长度是否合法
        if (idNumber.length !== 18) {
          return "Invalid ID number"
        }

        // 取得前四位和后四位
        const front = idNumber.substring(0, 4)
        const end = idNumber.substring(14)

        // 用星号替代中间数字
        const masked = front + "********" + end

        return masked
      }
      function on() {
        var queryString = window.location.search
        var urlParams = new URLSearchParams(queryString)
        var id = urlParams.get('id')
        fetch('http://api.ynjov.com:8080/api/getCertificatesDetail/' + id)
          .then(response => {
            
            if (!response.ok) {
              throw new Error('Network response was not ok')
            }
            return response.json()
          })
          .then(({ data }) => {
            
            var mp = data
            $("#NAME").html(mp.name.trim().replace(/(?<=.)./g, '*'))
            $("#SEX").html(mp.gender)
            $("#CARD_NUM").html(maskIDNumber(mp.idNumber.trim()))
            $("#COMPANY_NAME").html(mp.companyName)
            $("#CERTIFICATE_DEPARTMENT").html('云南省通信管理局')
            $("#CERTIFICATE_NUMBER").html(mp.certificateNumber)
            $("#POSITION").html(mp.position)
            $("#PROFESSIONAL_TITLE").html(mp.technicalTitle)
            $("#PUBLISH_DATE").html(mp.initialCertificationDate)
            $("#END_DATE").html(mp.validUntil)
          })
          .catch(error => {
            console.error('Fetch error:', error)
          })
      }
      on();
    </script>
  </div>
</body>

</html>